{include file='public/head'}
<body>
<style type="text/css" media="screen">
header {
    color: black;
}
</style>
<div class="x-body" >
	<form id="form" class="layui-form">

		  <div class="layui-form-item">
		    <label class="layui-form-label">期号</label>
		    <div class="layui-input-block">
		    <input type="text" id="period"  name="period" autocomplete="off" placeholder="请输入期号" class="layui-input">
		    </div>
		  </div>


		<div class="layui-form-item">
		    <label class="layui-form-label">red1</label>
		    <div class="layui-input-block">
		    <input type="text" id="red1"  name="red1" placeholder="red1" autocomplete="off" class="layui-input">
		    </div>
	  	</div>

	  	<div class="layui-form-item">
		    <label class="layui-form-label">red2</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="red2"  name="red2" placeholder="red2" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">red3</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="red3"  name="red3" placeholder="red3" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">red4</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="red4"  name="red4" placeholder="red4" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">red5</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="red5"  name="red5" placeholder="red5" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		<div class="layui-form-item">
		    <label class="layui-form-label">red6</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="red6"  name="red6" placeholder="red6" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		
		<div class="layui-form-item">
		    <label class="layui-form-label">blue</label>
		    <div class="layui-input-block">
		    	<input type="text"  id="blue"  name="blue" placeholder="blue" autocomplete="off" class="layui-input">
		    </div>
	  	</div>
		
		<div class="layui-form-item">
		    <div class="layui-input-block">
				<button  class="layui-btn" lay-filter="add" lay-submit="">添加</button>
		    </div>
		</div>


	</form>
</div>
</body>
{include file='public/foot'}
<script type="text/javascript">
	layui.use(['form','layer'], function(){
		$ = layui.jquery;
		var form = layui.form
				,layer = layui.layer;

		//监听提交
		form.on('submit(add)', function(data){
			console.log(data);
			var form = new FormData();
			var t = $('#form').serializeArray();
			$.each(t, function() {
				form.append(this.name,this.value);
			});
			$.ajax({
				url:"{:url('admin/Double/historyAdd')}",
				type:"post",
				data:form,
				dataType: "json",
				processData:false,
				contentType:false,
				success:function(data){
					if(data.code == 1){
						layer.msg(data.msg,{icon: 1, time: 2000});
						setTimeout(function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index); //执行关闭
							parent.location.href = window.parent.location;//返回父级页面
						},2000)
					}else{
						layer.msg(data.msg,{icon: 2, time: 2000});
					}
				}
			});
			return false;
		});

	});

</script>
